﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using dhSystemBLL.orderData;
using dhSystemBLL.produceBLL;
using baseSet.importExport;
using dhsystem.Main;

namespace dhsystem.orderForm
{
    public partial class FrmV_order : Form
    {
        public FrmV_order()
        {
            InitializeComponent();
        }

        private void FrmV_order_Load(object sender, EventArgs e)
        {
            orderMasterBLL orderMaster=new orderMasterBLL ();
            orderProduceListBLL orderProduceLsit=new orderProduceListBLL ();
            //string orderNo = dGridorder.CurrentRow.Cells["orderNo"].Value.ToString();
            bindingSourceorder.DataSource = orderMaster.getorderproduceTableAll();
            dGridorder.DataSource = bindingSourceorder;
            DcolumnSet.colSet(moduleInfo.V_orderproduceTable , dGridorder);
            toolStripStatusLabel1.Text = "数据总条数:" + dGridorder.RowCount.ToString() + "条";
        }

        private void toolExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void toolExport_Click(object sender, EventArgs e)
        {
            FrmExcelExport frm = new FrmExcelExport(moduleInfo.V_orderproduceTable, dGridorder, "订单信息");
            frm.ShowDialog();
        }

        private void toolQuery_Click(object sender, EventArgs e)
        {
            FrmDataQuery query = new FrmDataQuery(moduleInfo.V_orderproduceTable);
            DialogResult result = query.ShowDialog();
            if (result == DialogResult.Yes)
            {
                dGridorder.DataSource = query.rTable;
            }
        }

        private void buttonQuery_Click(object sender, EventArgs e)
        {
            try
            {
                baseSet.Query q = new baseSet.Query(null, dhDataAcess.baseBLL.dataConn.connOpen());
                bindingSourceorder.DataSource = q.sqlQueryLikeAll(moduleInfo.V_orderproduceTable, textMatNameQuery.Text.ToString().Trim());
                dGridorder.DataSource = bindingSourceorder;
                DcolumnSet.colSet(moduleInfo.V_orderproduceTable, dGridorder);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }

        private void buttupdate_Click(object sender, EventArgs e)
        {
            orderMasterBLL orderMaster = new orderMasterBLL();
            orderProduceListBLL orderProduceLsit = new orderProduceListBLL();
            //string orderNo = dGridorder.CurrentRow.Cells["orderNo"].Value.ToString();
            bindingSourceorder.DataSource = orderMaster.getorderproduceTableAll();
            dGridorder.DataSource = bindingSourceorder;
            DcolumnSet.colSet(moduleInfo.V_orderproduceTable, dGridorder);
            toolStripStatusLabel1.Text = "数据总条数:" + dGridorder.RowCount.ToString() + "条";
        }

        private void dGridorder_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }
    }
}
